package com.css.apps.base.sysjob.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.css.apps.base.common.provider.json.OrgJsonProvider;
import com.css.core.configuration.Environment;
import com.css.util.Ajax;
import com.css.util.Messages;
import com.css.webbase.webwork.action.AdminAction;
import com.opensymphony.xwork.Action;

import net.sf.json.JSONArray;

public class DirSysJobs extends AdminAction{
	private static final long serialVersionUID = 6052022256536199149L;
	private static Log log = LogFactory.getLog(DirSysJobs.class);
	private String upperTrees;
	
	@Override
	protected String adminGo() {
		try {
			JSONArray orgTree = new JSONArray();
			OrgJsonProvider json = new OrgJsonProvider();
			orgTree = json.getSubOrgan(null,null);
			upperTrees = json.getOrgPostTree("ac9a0398d28749b58ea64f17e2dcdef6").toString();
			setUpperTrees(upperTrees.toString());
			result = orgTree.toString();
			return Action.SUCCESS;
		} catch (Exception ex) {
			result = Ajax.JSONResult(Environment.RESULT_CODE_ERROR, Messages.getString("systemMsg.exception"));
			log.error(ex.getMessage(), ex);
			return Action.ERROR;
		}
	}
	
	public String getUpperTrees() {
		return upperTrees;
	}
	
	public void setUpperTrees(String upperTrees) {
		this.upperTrees = upperTrees;
	}
}